﻿#Region "Copyright/License"

'  Copyright (C) 2011, 2012, 2013 Paycircuit.com, Thinking Spot, Ed Chavez
'  http://goo.gl/jty8r
' 
'  Licensed under the Apache License, Version 2.0 (the "License");
'  you may not use this file except in compliance with the License.
'  You may obtain a copy of the License at
' 
'       http://www.apache.org/licenses/LICENSE-2.0
' 
'  Unless required by applicable law or agreed to in writing, software
'  distributed under the License is distributed on an "AS IS" BASIS,
'  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
'  See the License for the specific language governing permissions and
'  limitations under the License.

#End Region


Imports System.ComponentModel.DataAnnotations
Imports System.Runtime.Serialization

Namespace google.iap

    <DataContract()>
    Public Class InAppItemSubscriptionRequestObject
        Inherits RequestObject

#Region "Defaults"

        Private _sellerData As String = Nothing
        Private _name As String = String.Empty
        Private _description As String = Nothing

#End Region


        ''' <summary>
        ''' Required. The name of the item. This name is displayed prominently in the purchase flow UI and can have no more than 50 characters.
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        <Required()>
        <StringLength(50, ErrorMessage:="Maximum of 50 characters")>
        <DataMember(isRequired:=True)>
        Public Overrides Property name As String
            Get
                Return _name
            End Get
            Set(value As String)
                If Not String.IsNullOrEmpty(value) AndAlso value.Length <= 50 Then
                    _name = value
                Else
                    Throw New ArgumentOutOfRangeException("InAppItemSubscriptionRequestObject name", "Required. Maximimum of 50 characters")
                End If
            End Set
        End Property

        ''' <summary>
        ''' Optional: Text that describes the item. This description is displayed in the purchase flow UI and can have no more than 100 characters.
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        <StringLength(100, ErrorMessage:="Maximum of 100 characters")>
        <DataMember(EmitDefaultValue:=False, isRequired:=False)>
        Public Overrides Property description As String
            Get
                Return _description
            End Get
            Set(value As String)
                If value.Length <= 100 Then
                    _description = value
                Else
                    Throw New ArgumentOutOfRangeException("InAppItemSubscriptionRequestObject description", "Maximimum of 100 characters")
                End If
            End Set
        End Property


        ''' <summary>
        ''' Optional: Data to be passed to your success and failure callbacks. The string can have no more than 200 characters.
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        <StringLength(200, ErrorMessage:="Maximum of 200 characters")>
        <DataMember(EmitDefaultValue:=False, isRequired:=False)>
        Public Overrides Property sellerData As String
            Get
                Return _sellerData
            End Get
            Set(value As String)
                If value.Length <= 200 Then
                    _sellerData = value
                Else
                    Throw New ArgumentOutOfRangeException("InAppItemSubscriptionRequestObject sellerData", "Maximimum of 200 characters")
                End If
            End Set
        End Property

        <DataMember(EmitDefaultValue:=False, isRequired:=False)>
        Public Overrides Property initialPayment As InAppSubscriptionInitialPaymentObject = Nothing

        <DataMember(isRequired:=True)>
        Public Overrides Property recurrence As InAppSubscriptionRecurrenceObject = Nothing


        Public Sub New()
        End Sub

    End Class

End Namespace
